/*
 * Copyright (c) 2025 Industrial Software Feature Database
 */
package com.comac.ins.isfd.service;


import com.comac.ins.isfd.domain.vo.GridFsTreeNodeVo;
import com.mongodb.client.gridfs.GridFSFindIterable;
import org.springframework.data.mongodb.gridfs.GridFsResource;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;
import java.util.List;
import java.util.concurrent.ExecutionException;

public interface IGridFsService {
    /**
     * 上传文件到GridFS
     */
    List<String> uploadFile(MultipartFile[] files, String versionId, String taskId, String type) throws IOException, ExecutionException, InterruptedException;

    /**
     * 根据ID下载文件
     */
    GridFsResource downloadFileById(String fileId);

    /**
     * 根据文件名下载文件
     */
    GridFsResource downloadFileByName(String fileName, String versionId, String taskId);

    /**
     * 获取文件列表
     */
    GridFSFindIterable listFiles(String taskId);

    /**
     * 删除文件
     */
    void deleteFile(String fileId);

    /**
     * 复制文件
     */
    void copyFiles(String oldVersionId, String newVersionId);

    /**
     * 批量删除
     */
    void deleteFiles(String taskId);

    /**
     * 根据 versionId 构建文件夹树
     */
    GridFsTreeNodeVo buildFolderTreeByVersionId(String versionId, String fileName);
}
